package io_nio;


import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

public class SystemOutDemo {
    public static void main(String[] args) {
        PrintStream ps = null;
        try {
            ps = new PrintStream(new FileOutputStream("E:/pp3/IO_Demo.txt"));
            System.setOut(ps);//设置标准输出到输出流，而不是屏幕
            System.out.println("测试标准输出到输出流");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }finally {
            if (ps != null){
                ps.close();
            }
        }
    }
}
